import { Component } from '@angular/core';
import { IonicModule, NavController } from '@ionic/angular';
import { DetailPage } from '../detail/detail.page'

import { NavigationOptions } from '@ionic/angular/dist/providers/nav-controller';
import { NavigationExtras, Router, ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

  mydata: any
  account: String
  selected_1: Boolean
  selected_2: Boolean
  selected_3: Boolean

  constructor(private activeRoute: ActivatedRoute, public nav: NavController, private router: Router) {
    this.selected_1 = false;
    this.selected_2 = true;
    this.selected_3 = false;
    console.log(this.activeRoute.queryParams)
    this.mydata = [
      {
        //https://item.jd.com/100000009811.html
        img: "https://img11.360buyimg.com/n1/jfs/t30559/226/751774559/268885/2f9f70b2/5bfd040bN44137661.jpg",
        name: "儿童白色舞蹈袜子",
        price: 30.99,
        score: 4.8,
        stars: 5,
        index: 0,
      },
      {
        // https://item.jd.com/11691215480.html
        img: "https://img10.360buyimg.com/n1/jfs/t1/24959/4/10179/143996/5c83e5b5E47bc80f6/26a26604a7c86186.jpg",
        name: "婴儿内衣套装纯棉春秋",
        price: 59.00,
        score: 4.9,
        stars: 5,
        index: 1,
      },
      {
        //https://item.jd.com/40526501607.html
        img: "https://img12.360buyimg.com/n1/jfs/t1/21176/7/3530/218667/5c288387Ec65f4011/4acd494ac585daa4.jpg",
        name: "2018新款潮亲子全家装",
        price: 208.00,
        score: 4.8,
        stars: 5,
        index: 2,
      },
      {
        // https://item.jd.com/21144823241.html
        img: "https://img11.360buyimg.com/n1/jfs/t16240/213/744372352/375324/628eb952/5a3cc850Nf9c4404a.jpg",
        name: "连帽休闲卫衣家庭装亲子",
        price: 198.00,
        score: 4.7,
        stars: 5,
        index: 3,
      },
      {
        // https://item.jd.com/19031093274.html
        img: "https://img14.360buyimg.com/n1/jfs/t10156/317/2460272034/419021/b64fdc1f/59f83451N1faaed3c.jpg",
        name: "2019新品潮母女装母子装",
        price: 58.00,
        score: 4.7,
        stars: 5,
        index: 4,
      },
      {
        // https://item.jd.com/30651952146.html#crumb-wrap
        img: "https://img11.360buyimg.com/n1/jfs/t1/23724/33/6280/169281/5c4ae04dEf1da8ba9/c4f4b3b48572e9cb.jpg",
        name: "童装女童套装加绒保暖",
        price: 99.00,
        score: 5.0,
        stars: 4,
        index: 5,
      }
    ]
    this.activeRoute.queryParams.subscribe(params => {
      // let index = params["index"];
      console.log(params)
      if (params.size == 0) {
        this.account = "请登录"
      } else {
        if (params["username"] != null) {
          this.account = params["username"];
        } else {
          this.account = "请登录"
        }
      }
    });
  }

  public changetoall() {
    this.selected_2 = false;
    this.selected_1 = true;
    this.selected_3 = false;
    console.log("评分优先")
    this.mydata = [
      {
        // https://item.jd.com/30651952146.html#crumb-wrap
        img: "https://img11.360buyimg.com/n1/jfs/t1/23724/33/6280/169281/5c4ae04dEf1da8ba9/c4f4b3b48572e9cb.jpg",
        name: "童装女童套装加绒保暖",
        price: 99.00,
        score: 5.0,
        stars: 4,
        index: 5,
      },
      {
        // https://item.jd.com/11691215480.html
        img: "https://img10.360buyimg.com/n1/jfs/t1/24959/4/10179/143996/5c83e5b5E47bc80f6/26a26604a7c86186.jpg",
        name: "婴儿内衣套装纯棉春秋",
        price: 59.00,
        score: 4.9,
        stars: 5,
        index: 1,
      },
      {
        //https://item.jd.com/100000009811.html
        img: "https://img11.360buyimg.com/n1/jfs/t30559/226/751774559/268885/2f9f70b2/5bfd040bN44137661.jpg",
        name: "儿童白色舞蹈袜子",
        price: 30.99,
        score: 4.8,
        stars: 5,
        index: 0,
      },
      {
        //https://item.jd.com/40526501607.html
        img: "https://img12.360buyimg.com/n1/jfs/t1/21176/7/3530/218667/5c288387Ec65f4011/4acd494ac585daa4.jpg",
        name: "2018新款潮亲子全家装",
        price: 208.00,
        score: 4.8,
        stars: 5,
        index: 2,
      },
      {
        // https://item.jd.com/21144823241.html
        img: "https://img11.360buyimg.com/n1/jfs/t16240/213/744372352/375324/628eb952/5a3cc850Nf9c4404a.jpg",
        name: "连帽休闲卫衣家庭装亲子",
        price: 198.00,
        score: 4.7,
        stars: 5,
        index: 3,
      },
      {
        // https://item.jd.com/19031093274.html
        img: "https://img14.360buyimg.com/n1/jfs/t10156/317/2460272034/419021/b64fdc1f/59f83451N1faaed3c.jpg",
        name: "2019新品潮母女装母子装",
        price: 58.00,
        score: 4.7,
        stars: 5,
        index: 4,
      },

    ]
  }
  
  public changetoscore() {
    this.selected_1 = false;
    this.selected_2 = true;
    this.selected_3 = false;
    console.log("综合评价")
    this.mydata = [
      {
        //https://item.jd.com/100000009811.html
        img: "https://img11.360buyimg.com/n1/jfs/t30559/226/751774559/268885/2f9f70b2/5bfd040bN44137661.jpg",
        name: "儿童白色舞蹈袜子",
        price: 30.99,
        score: 4.8,
        stars: 5,
        index: 0,
      },
      {
        // https://item.jd.com/11691215480.html
        img: "https://img10.360buyimg.com/n1/jfs/t1/24959/4/10179/143996/5c83e5b5E47bc80f6/26a26604a7c86186.jpg",
        name: "婴儿内衣套装纯棉春秋",
        price: 59.00,
        score: 4.9,
        stars: 5,
        index: 1,
      },
      {
        //https://item.jd.com/40526501607.html
        img: "https://img12.360buyimg.com/n1/jfs/t1/21176/7/3530/218667/5c288387Ec65f4011/4acd494ac585daa4.jpg",
        name: "2018新款潮亲子全家装",
        price: 208.00,
        score: 4.8,
        stars: 5,
        index: 2,
      },
      {
        // https://item.jd.com/21144823241.html
        img: "https://img11.360buyimg.com/n1/jfs/t16240/213/744372352/375324/628eb952/5a3cc850Nf9c4404a.jpg",
        name: "连帽休闲卫衣家庭装亲子",
        price: 198.00,
        score: 4.7,
        stars: 5,
        index: 3,
      },
      {
        // https://item.jd.com/19031093274.html
        img: "https://img14.360buyimg.com/n1/jfs/t10156/317/2460272034/419021/b64fdc1f/59f83451N1faaed3c.jpg",
        name: "2019新品潮母女装母子装",
        price: 58.00,
        score: 4.7,
        stars: 5,
        index: 4,
      },
      {
        // https://item.jd.com/30651952146.html#crumb-wrap
        img: "https://img11.360buyimg.com/n1/jfs/t1/23724/33/6280/169281/5c4ae04dEf1da8ba9/c4f4b3b48572e9cb.jpg",
        name: "童装女童套装加绒保暖",
        price: 99.00,
        score: 5.0,
        stars: 4,
        index: 5,
      }

    ]
  }
  public changetoprice() {
    this.selected_1 = false;
    this.selected_3 = true;
    this.selected_2 = false;
    console.log("价格优先")
    this.mydata = [
      {
        // https://item.jd.com/11691215480.html
        img: "https://img10.360buyimg.com/n1/jfs/t1/24959/4/10179/143996/5c83e5b5E47bc80f6/26a26604a7c86186.jpg",
        name: "婴儿内衣套装纯棉春秋",
        price: 59.00,
        score: 4.9,
        stars: 5,
        index: 1,
      },
      {
        //https://item.jd.com/100000009811.html
        img: "https://img11.360buyimg.com/n1/jfs/t30559/226/751774559/268885/2f9f70b2/5bfd040bN44137661.jpg",
        name: "儿童白色舞蹈袜子",
        price: 30.99,
        score: 4.8,
        stars: 5,
        index: 0,
      },
      {
        // https://item.jd.com/21144823241.html
        img: "https://img11.360buyimg.com/n1/jfs/t16240/213/744372352/375324/628eb952/5a3cc850Nf9c4404a.jpg",
        name: "连帽休闲卫衣家庭装亲子",
        price: 198.00,
        score: 4.7,
        stars: 5,
        index: 3,
      },

      {
        //https://item.jd.com/40526501607.html
        img: "https://img12.360buyimg.com/n1/jfs/t1/21176/7/3530/218667/5c288387Ec65f4011/4acd494ac585daa4.jpg",
        name: "2018新款潮亲子全家装",
        price: 208.00,
        score: 4.8,
        stars: 5,
        index: 2,
      },
      {
        // https://item.jd.com/30651952146.html#crumb-wrap
        img: "https://img11.360buyimg.com/n1/jfs/t1/23724/33/6280/169281/5c4ae04dEf1da8ba9/c4f4b3b48572e9cb.jpg",
        name: "童装女童套装加绒保暖",
        price: 99.00,
        score: 5.0,
        stars: 4,
        index: 5,
      },
      {
        // https://item.jd.com/19031093274.html
        img: "https://img14.360buyimg.com/n1/jfs/t10156/317/2460272034/419021/b64fdc1f/59f83451N1faaed3c.jpg",
        name: "2019新品潮母女装母子装",
        price: 58.00,
        score: 4.7,
        stars: 5,
        index: 4,
      },


    ]
  }

  public detail(i: number) {
    console.log("点击了：" + i)
    let detaildata: NavigationExtras = {
      queryParams: {
        "index": i
      }
    }
    // options: {
    //   Number: name: index
    // }

    // this.nav.navigateForward("/detail", detaildata)
    this.router.navigate(['/detail'], detaildata)

  }
}


1// https://item.jd.com/40526501607.html
//颜色很正，过年很喜庆，一家三口穿起来很有爱。只是感觉他家成人码偏大。宝宝的码比较合适。只是领子那里偏小，脱起来着实费了一番功夫。
//衣服已收到！质量很不错！图片很可爱，布料摸起来很舒服，穿上很合适，也不掉色和变形，这个价格值了！好评！
//衣服已收到！质量很不错！图片好可爱的，布料摸起来很舒服，穿上很合适，也不掉色和变形，值得购买！
//很适合一家人穿，图案颜色都行


2// https://item.jd.com/100000009811.html
// j***g2019-03-12
// 质量非常好，做活动的时候买的，更划算，厚款和薄款各买了一双
//  逸***晨2018-12-01
// 值得信赖，一次买了两条，相信自发热的毛绒裤。以后宝宝跳舞就不会冷了。
//  1***o2019-02-01
// 手感很好，触摸光滑柔软，弹性也很好，不是特别厚，0°左右穿应该可以
//  未***糖2019-01-01
// 质量不错，一次买了好多件，快递很快


// 1  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swapfrqtj305k05kwei.jpg
// 2  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcg036fj305k05kt8q.jpg
// 3  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swcv8cflj305k05k74a.jpg
// 4  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd4d2isj305k05kq2z.jpg
// 5  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swd9l7zpj305k05kdfu.jpg
// 6  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swdkykavj305k05kmx7.jpg
// 7  http://ww1.sinaimg.cn/large/006M5LK3ly1g1swe53ebhj305k05k0sr.jpg
// 8  http://ww1.sinaimg.cn/large/006M5LK3ly1g1sweda941j305k05k3yj.jpg

3// https://item.jd.com/40526501607.html
//衣服很好，卖家服务也很好
//衣服质量挺好的
//款式很给力

4// https://item.jd.com/21144823241.html

//  K***n2019-01-28
// 过年啦！就要穿得喜庆！亲子装，很不错！
//  没***恼2018-11-23
// 下次有新款还会关顾本店！
//  没***恼2018-11-23
// 衣服质量很好！穿上合身
//  b***22018-11-05
// 不错，就是领口有点小

5// https://item.jd.com/19031093274.html

// 军***华2018-12-14
// 刚收到货了，看到大红色，很喜庆，本来是想买薄的，北方屋里穿，所以没选有帽子的，里面有绒，但不是很厚的，不知道褪色不，没洗呢。号码差不多。
//  军***华2018-12-14
// 质量还好，薄绒，屋里穿有暖气够了，很喜庆的颜色，没有洗，不知道褪色不
//  阿***哥2019-01-27
// 过年穿很漂亮，质量也特好的
//  幽***德2018-12-02
// 衣服已收到！质量很不错！图片很可爱，布料摸起来很舒服，穿上很合适，也不掉色和变形，这个价格值了！好评！
//  j***c2018-12-06
// 衣服收到好几天了，质量不错，面料柔软舒适，洗了也不掉色，放假一家人穿出去玩，朋友见了说好看，推荐

6// https://item.jd.com/30651952146.html#crumb-wrap
//j***n2018-10-21
// 物流快递很给力是我想要的商品, 比实体店实惠多了, 很满意的一次购物下次准备入手
// j***o2019-01-08
// 马褂颜色没照片鲜，有点哑色，马褂口袋接口处露了棉，自己加针上去，总体来说还是可以的
// 即***购2018-12-23
// 不错，不错的。很保暖，大小很合适，不掉色，嗯嗯～
// S***F2018-12-19
// 衣服很厚，很合适冬天穿，整体来讲挺不错都
// j***v2018-12-03
// 质量超好，手感特别舒服，样子也漂亮。美中不足就是号偏小，我们平时穿160还有点量，这款上衣还行，裤子就太短了
// G***J2018-11-16
// 衣服大小合适。面料很舒服也比较厚实，非常不错值得购买
